#include <string>
#include <logger.h>

void ReplaceAll(std::string& inout, const std::string &what, const std::string &with)
{
    std::string::size_type pos = 0;
    pos = inout.find(what.data(), pos, what.length());
    while (inout.npos != pos) {
        inout.replace(pos, what.length(), with.data(), with.length());
        pos += with.length();
        pos = inout.find(what.data(), pos, what.length());
    }
}

int main()
{
    std::string s = "a b c  d ";
    VALUE_LOGGER(s);
    ReplaceAll(s, " ", "_");
    VALUE_LOGGER(s);

    VALUE_LOGGER(s.substr(2, 100));
    return 0;
}
